//Handler after imajnet was activated ImajnetPlugin.onImajnetActivated = function() { //Set coordinates var lon = 1.3770020229167332; var lat = 43.731923438436134; //Get closest image to this coordinates ImajnetPlugin.getOrientedImages(lon, lat); //Zoom map to view images ImajnetPlugin.zoomMapTo(18); } //Function that will get the oriented images at those coordinates ImajnetPlugin.getOrientedImages = function(lon, lat) { //Set imajnet mode to closest image; Imajnet.activateImajnetControl(null, 'clickMode'); //Pass the coordinates to the imajnet library ImajnetMap.mapClickHandler({ lon: lon, lat: lat }); } //Register events on the map to get oriented images on click ImajnetPlugin.registerMapEvents = function() { map.on('click', onMapClick); } function onMapClick(event) { var coordinate = ol.proj.transform(event.coordinate, webMercator, wgs84); ImajnetPlugin.getOrientedImages(coordinate[0], coordinate[1]); }